Skip to content

Conversation

rholinshead
Copy link
Member

@rholinshead rholinshead commented Sep 11, 2025

Description

Remove reference to internal app_ctx argument

Screenshot 2025-09-11 at 6 30 54 PM

Summary by CodeRabbit

  • Improvements

    • You can now run the orchestrator without explicitly passing an app context; it automatically uses the app’s context when omitted, preserving existing behavior.
  • Documentation

    • Updated parameter description and usage guidance to reflect the optional app context.

Copy link

coderabbitai bot commented Sep 11, 2025

Walkthrough

Updated examples/temporal/orchestrator.py to make the run_orchestrator app_ctx parameter optional (default None) and adjusted the docstring accordingly. Runtime behavior remains the same by falling back to app.context when app_ctx is not provided.

Changes

Cohort / File(s) Summary
Orchestrator parameter default
examples/temporal/orchestrator.py
Set app_ctx default to None in run_orchestrator signature; removed app_ctx from docstring Args; logic continues to use app_ctx or app.context with no changes to return type or orchestration flow.

Sequence Diagram(s)

sequenceDiagram
  participant Caller
  participant Orchestrator as run_orchestrator
  participant App as app
  participant Ctx as AppContext

  Caller->>Orchestrator: run_orchestrator(input, app_ctx=None|Ctx)
  alt app_ctx provided
    Orchestrator->>Ctx: use provided app_ctx
  else app_ctx not provided
    Orchestrator->>App: access app.context
    App-->>Orchestrator: default context
  end
  Orchestrator-->>Caller: result (str)
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • roman-van-der-krogt
  • saqadri

Pre-merge checks (3 passed)

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "Update OrchestratorWorkflow tool docstring" concisely and accurately reflects the PR description and the primary change of removing the internal app_ctx reference from the docstring, and it is specific and clear for a teammate scanning history. It directly relates to the changes in examples/temporal/orchestrator.py and is not vague or noisy. While the code also sets app_ctx to default to None, that additional detail does not make the title misleading.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

Poem

A nibble of code, a hop in time,
app_ctx optional—feels sublime.
If none is passed, no need to fret,
app.context catches it yet.
I twitch my whiskers, tests align—
orchestration hums, all working fine. 🐇✨

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.

✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/temporal-deployable-examples

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Args:
input: Task description or instruction text.
app_ctx: Optional application context for the workflow.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docstring line describing the app_ctx parameter is being removed, but the parameter still exists in the function signature. This creates inconsistent documentation where the function has an app_ctx parameter but no documentation for it. The docstring should be updated to describe the app_ctx parameter with its new default value behavior, not removed entirely.

Suggested change
:param app_ctx: Application context (defaults to None)

Spotted by Diamond

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
examples/temporal/orchestrator.py (2)

35-37: Fix docstring return type to match implementation

Docstring says “WorkflowResult” but the function returns a str from orchestrator.generate_str(...).

Apply:

-    Returns:
-        A WorkflowResult containing the processed data
+    Returns:
+        str: The generated orchestration output.

39-41: Guard filesystem args and avoid duplicate cwd entries

  • Use explicit None check to avoid surprise if AppContext ever defines falsy semantics.
  • Avoid KeyError if “filesystem” server is absent.
  • Prevent duplicate cwd entries on repeated calls.

Apply:

-    context = app_ctx or app.context
-    context.config.mcp.servers["filesystem"].args.extend([os.getcwd()])
+    context = app_ctx if app_ctx is not None else app.context
+    fs = context.config.mcp.servers.get("filesystem")
+    if fs is not None:
+        cwd = os.getcwd()
+        if cwd not in fs.args:
+            fs.args.append(cwd)
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b9fe450 and 2be914e.

📒 Files selected for processing (1)
  • examples/temporal/orchestrator.py (1 hunks)
🔇 Additional comments (2)
examples/temporal/orchestrator.py (2)

28-28: Making app_ctx optional is fine

Defaulting app_ctx to None aligns with the intent to not require callers to pass internal context.


27-28: app_ctx is already filtered from public tool schemas — no action required.

Tool-registration explicitly drops/filters an app_ctx parameter when generating function signatures/schemas (see src/mcp_agent/server/app_server.py and src/mcp_agent/server/tool_adapter.py); src/mcp_agent/app.py also detects AppContext parameters.

@rholinshead rholinshead merged commit a3ba378 into main Sep 11, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants